package org.optionparser;

import java.util.Map.Entry;

import org.junit.Test;


import junit.framework.TestCase;

public class ArgumentParsingTest extends TestCase{

	@Test
	public void testGeneral() {
		String[] inputArguments = {"-l","-50","55", "--","5","-v"};
		
		OptionParser parser = new OptionParser(inputArguments);
		parser.addOptionalBooleanOption("v", "b", ParameterType.Optional, "Version", "nejaky popis ktory moze byt velmi dlhy a nezmesti sa na jeden riadok by mal byt na dalsom riadku aspon odsadeny a idealne odseknuty podla sirky okna. Ako sa mozme presvecit, print tuto situaciu neriesi a dlhsi text zobrazuje velmi jednoducho.");
		parser.addOptionalIntegerOption("l", "loglevel", ParameterType.Optional, "vvv", null, null, "Integer argument");

		try {
			parser.parse();
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			assertFalse("Parser throws error",true);
		}

		try {
			for (Entry<String, String> resultEntry : parser.getResults().entrySet())
			{
				System.out.println(String.format("%s -> %s", resultEntry.getKey(), resultEntry.getValue()));
			}
			for (String argument : parser.getArguments()) {
				System.out.println(String.format("Argument %s ", argument));
				
			}
			
			
			parser.printOptionsInfo();
			assertTrue(parser.containsOption("l"));
			
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			assertFalse(true);
		}
		
		
		
		
		
		
	}
}
